﻿namespace WMS6.Web.Configuration
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class CycleCountClassQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlClassID;
        protected DropDownList ddlCycleDays;
        protected DropDownList ddlIsActive;
        protected DropDownList ddlIsActiveOper;
        protected DropDownList ddlNegCntVariance;
        protected DropDownList ddlNegValueVariance;
        protected DropDownList ddlPosQtyVariance;
        protected DropDownList ddlPosValueVariance;
        protected HtmlForm F2280;
        protected HtmlInputHidden hdnActionID;
        protected Label lblBu;
        protected Label lblClassID;
        protected Label lblCycleDays;
        protected Label lblIsActive;
        protected Label lblNegCntVariance;
        protected Label lblNegValueVariance;
        protected Label lblPosQtyVariance;
        protected Label lblPosValueVariance;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtClassID;
        protected TextBox txtCycleDays;
        protected TextBox txtNegCntVariance;
        protected TextBox txtNegValueVariance;
        protected TextBox txtPosQtyVariance;
        protected TextBox txtPosValueVariance;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("CycleCountClassList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.InitQueryDDL(this.ddlClassID, 0);
            base.InitQueryDDL(this.ddlCycleDays, 0);
            base.InitQueryDDL(this.ddlNegCntVariance, 0);
            base.InitQueryDDL(this.ddlNegValueVariance, 0);
            base.InitQueryDDL(this.ddlPosQtyVariance, 0);
            base.InitQueryDDL(this.ddlPosValueVariance, 0);
            base.InitQueryDDL(this.ddlIsActiveOper, 0);
            base.InitIsActiveDDL(this.ddlIsActive, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
            }
            if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
            {
                this.btnExport.Visible = false;
                this.btnNew.Visible = false;
                this.ddlIsActive.SelectedValue = "Y";
                this.ddlIsActive.Enabled = false;
            }
        }

        public string ClassID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtClassID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtClassID.Text.Trim(), this.ddlClassID.SelectedValue);
                }
                return "";
            }
        }

        public string CycleDays
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCycleDays.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCycleDays.Text.Trim(), this.ddlCycleDays.SelectedValue);
                }
                return "";
            }
        }

        public string IsActive
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlIsActive.SelectedValue))
                {
                    return base.GetParamsString(this.ddlIsActive.SelectedValue, this.ddlIsActiveOper.SelectedValue);
                }
                return "";
            }
        }

        public string NegCntVariance
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtNegCntVariance.Text.Trim()))
                {
                    return base.GetParamsString(this.txtNegCntVariance.Text.Trim(), this.ddlNegCntVariance.SelectedValue);
                }
                return "";
            }
        }

        public string NegValueVariance
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtNegValueVariance.Text.Trim()))
                {
                    return base.GetParamsString(this.txtNegValueVariance.Text.Trim(), this.ddlNegValueVariance.SelectedValue);
                }
                return "";
            }
        }

        public string PosQtyVariance
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPosQtyVariance.Text.Trim()))
                {
                    return base.GetParamsString(this.txtPosQtyVariance.Text.Trim(), this.ddlPosQtyVariance.SelectedValue);
                }
                return "";
            }
        }

        public string PosValueVariance
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPosValueVariance.Text.Trim()))
                {
                    return base.GetParamsString(this.txtPosValueVariance.Text.Trim(), this.ddlPosValueVariance.SelectedValue);
                }
                return "";
            }
        }
    }
}

